package com.ruoyi.server.api.memberUserManagement.mapper;

import java.util.List;

import com.ruoyi.server.api.coach.domain.CoachManagement;
import com.ruoyi.server.api.memberBindCardRecord.domain.MemberBindCardRecord;
import com.ruoyi.server.api.memberCardNumber.domain.MemberCardNumber;
import com.ruoyi.server.api.memberUserManagement.domain.MemberUserManagement;
import com.ruoyi.server.api.memberUserManagement.model.MemberUserAndBindCardModel;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.security.core.parameters.P;

/**
 * 会员用户Mapper接口
 *
 * @author zmh
 * @date 2024-06-11
 */
@Mapper
public interface MemberUserManagementMapper
{
    /**
     * 查询会员用户
     *
     * @param id 会员用户主键
     * @return 会员用户
     */
    public MemberUserManagement selectMemberUserManagementById(Long id);

    /**
     * 查询会员用户 普通会员和vip私教会员
     *
     * @param memberUserManagement 会员用户
     * @return 会员用户集合
     */
    public List<MemberUserManagement> selectMemberUserManagementList(MemberUserManagement memberUserManagement);
    /**
    * @Author ZMH
    * @Description 根据id查询用户状态
    * @Date 2024/6/14 14:54
    * @Return
    * @param id
    */
    MemberUserManagement getByUserType(@Param("id") Integer id,@Param("venueUniqueIdentifier") String venueUniqueIdentifier);
    /**
     * @Author ZMH
     * @Description 根据id修改用户状态
     * @Date 2024/6/14 14:59
     * @Return
     * @param id,userType
     */
    MemberUserManagement updateUserType(@Param("id") Integer id,@Param("userType") Integer userType,@Param("venueUniqueIdentifier") String venueUniqueIdentifier);
    /**
    * @Author ZMH
    * @Description 根据id获取会员信息
    * @Date 2024/6/11 10:58
    * @Return com.ruoyi.server.api.memberUserManagement.model.MemberUserAndTypeModel
    * @param id venueUniqueIdentifier
    */
    MemberUserAndBindCardModel getById(@Param("id") Integer id , @Param("venueUniqueIdentifier") String venueUniqueIdentifier);
    /**
    * @Author ZMH
    * @Description 根据手机号查询会员用户信息
    * @Date 2024/6/12 19:05
    * @Return com.ruoyi.server.api.memberUserManagement.domain.MemberUserManagement
    * @param memberUserPhone venueUniqueIdentifier
    */
    MemberUserManagement selectPhone(@Param("memberUserPhone") String  memberUserPhone ,@Param("venueUniqueIdentifier") String venueUniqueIdentifier);


    /**
     * 新增会员用户
     *
     * @param memberUserManagement 会员用户
     * @return 结果
     */
    public int insertMemberUserManagement(MemberUserManagement memberUserManagement);

    /**
     * 修改会员用户
     *
     * @param memberUserManagement 会员用户
     * @return 结果
     */
    public int updateMemberUserManagement(MemberUserManagement memberUserManagement);
    /**
    * @Author ZMH
    * @Description 修改会员绑卡记录
    * @Date 2024/6/18 10:31
    * @Return
    * @param memberBindCardRecord
    */
    int updateMemberBindCardRecord(MemberBindCardRecord memberBindCardRecord);

    /**
     * 删除会员用户
     *
     * @param id 会员用户主键
     * @return 结果
     */
    public int deleteMemberUserManagementById(Long id);

    /**
     * 批量删除会员用户
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteMemberUserManagementByIds(Long[] ids);
    /**
     * @Author hjh
     * @Description 根据卡号获取会员信息
     * @Date 2024/6/12 21:37
     * @Return com.ruoyi.server.api.memberUserManagement.domain.MemberUserManagement
     * @param membershipCardNumber
     * @param venueUniqueIdentifier
     */
    public MemberUserAndBindCardModel selectUserInfoByNumid (@Param("membershipCardNumber") String membershipCardNumber,
                                                       @Param("venueUniqueIdentifier") String venueUniqueIdentifier);
    /**
    * @Author hjh
    * @Description 查询当天入场人数
    * @Date 2024/6/13 9:40
    * @Return java.util.List<com.ruoyi.server.api.memberCardNumber.domain.MemberCardNumber>
    * @param venueUniqueIdentifier
* @param currentDate
    */
    public List<MemberCardNumber> selectEntranceNumber (@Param("venueUniqueIdentifier") String venueUniqueIdentifier,
                                                        @Param("currentDate") String currentDate);

    /**
    * @Author hjh
    * @Description 查询会员是否入场
    * @Date 2024/6/13 10:43
    * @Return java.util.List<com.ruoyi.server.api.memberCardNumber.domain.MemberCardNumber>
    * @param venueUniqueIdentifier
* @param membershipCardNumber
* @param updateTime
    */
    List<MemberCardNumber> userIfEntrance (@Param("venueUniqueIdentifier") String venueUniqueIdentifier,
                                           @Param("membershipCardNumber") String membershipCardNumber,
                                           @Param("updateTime") String updateTime);


    /**
     * @Author 胡家浩
     * @Description 会员多次刷卡 （更新刷卡时间）
     * @Date 2024/5/16 20:31
     * @Return int
     * @param memberCardNumber
     */
    int userDepartureUpdate (MemberCardNumber memberCardNumber);
    /**
     * @Author 胡家浩
     * @Description 会员刷卡入场
     * @Date 2024/5/16 20:27
     * @Return int
     * @param memberCardNumber
     */
    int userEntranceInsert (MemberCardNumber memberCardNumber);

    /**
     * @Author 胡家浩
     * @Description 查询用户会员卡类型
     * @Date 2024/5/17 15:06
     * @Return com.zhuiyun.project.api.memberUserManagement.model.MemberUserAndTypeModel
     * @param venueUniqueIdentifier
     * @param membershipCardNumber
     */
    MemberUserAndBindCardModel selectUserMemberType (@Param(("venueUniqueIdentifier"))String venueUniqueIdentifier,
                                                     @Param(("membershipCardNumber"))String membershipCardNumber);
    /**
     * @Author wx
     * @Description 入场次数加一
     * @Date 2023/12/28 8:45
     * @Return
     * @param id
     */
    int addOnlineTimes(@Param(("venueUniqueIdentifier"))String venueUniqueIdentifier, @Param(("id"))Integer id);

    /**
    * @Author hjh
    * @Description 减去一次刷卡次数
    * @Date 2024/6/13 11:10
    * @Return int
    * @param id
    */
    int deleteByMemberUserPhone(@Param(("venueUniqueIdentifier")) String venueUniqueIdentifier,@Param("id") Integer id);

    /**
    * @Author hjh
    * @Description 查询会员是否有私教
    * @Date 2024/6/16 20:48
    * @Return int
    * @param membershipCardNumber
    * @param venueUniqueIdentifier
    */
    List<CoachManagement> selectIfPersonalTrainer (@Param(("venueUniqueIdentifier")) String venueUniqueIdentifier, @Param("membershipCardNumber") String membershipCardNumber);

    /**
    * @Author hjh
    * @Description 判断会员卡是否有会员
    * @Date 2024/6/17 14:16
    * @Return int
    * @param membershipCardNumber
* @param venueUniqueIdentifier
    */
    int ifMemberCardBind (@Param("membershipCardNumber") String membershipCardNumber, @Param("venueUniqueIdentifier") String venueUniqueIdentifier);
}
